/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package geometry;

/**
 *
 * @author Daniel Ogburn
 */
public class GeometryMath 
{
    public static double dotProduct3d(Vector3D vector1, Vector3D vector2)
    {
        return((vector1.x*vector2.x)+(vector1.y*vector2.y)+(vector1.z+vector2.z));
    }
    
    public static double angleBetween(Vector3D vector1, Vector3D vector2)
    {
        return (Math.acos(dotProduct3d(vector1,vector2)/(vector1.getMagnitude()*vector2.getMagnitude())));
        
    }
    
    public static Vector3D vectorADD(Vector3D vector1, Vector3D vector2)
    {
        return( new Vector3D((vector1.x+vector2.x),(vector1.y+vector2.y),(vector1.z+vector2.z)));
    }
    
    public static Vector3D vectorSUB(Vector3D vector1, Vector3D vector2)
    {
        return( new Vector3D((vector1.x-vector2.x),(vector1.y-vector2.y),(vector1.z-vector2.z)));
    }
    
    
    
    public static Vector3D scalarMulti(double aScalar, Vector3D someVector)
    {
       return(new Vector3D((aScalar*someVector.x),(aScalar*someVector.y),(aScalar*someVector.z)));
    }
    
    public static Vector3D crossProduct(Vector3D vector1, Vector3D vector2)
    {
       Vector3D newVector = new Vector3D();
      
       newVector.x = ((vector1.y*vector2.z)-(vector2.y*vector1.z));
       newVector.y = -1*((vector1.x*vector2.z)-(vector2.x*vector1.z));
       newVector.z = ((vector1.x*vector2.y)-(vector2.x*vector1.y));
       
       
       
       
       return newVector;
       
        
        
        
    }
    
    
    
    
}
